# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.FCM.V1.Model.AndroidConfig do
  @moduledoc """
  Android specific options for messages sent through [FCM connection server](https://goo.gl/4GLdUl).

  ## Attributes

  *   `bandwidthConstrainedOk` (*type:* `boolean()`, *default:* `nil`) - Optional. If set to true, messages will be allowed to be delivered to the app while the device is in bandwidth constrained mode.
  *   `collapseKey` (*type:* `String.t`, *default:* `nil`) - An identifier of a group of messages that can be collapsed, so that only the last message gets sent when delivery can be resumed. A maximum of 4 different collapse keys is allowed at any given time.
  *   `data` (*type:* `map()`, *default:* `nil`) - Arbitrary key/value payload. If present, it will override google.firebase.fcm.v1.Message.data.
  *   `directBootOk` (*type:* `boolean()`, *default:* `nil`) - If set to true, messages will be allowed to be delivered to the app while the device is in direct boot mode. See [Support Direct Boot mode](https://developer.android.com/training/articles/direct-boot).
  *   `fcmOptions` (*type:* `GoogleApi.FCM.V1.Model.AndroidFcmOptions.t`, *default:* `nil`) - Options for features provided by the FCM SDK for Android.
  *   `notification` (*type:* `GoogleApi.FCM.V1.Model.AndroidNotification.t`, *default:* `nil`) - Notification to send to android devices.
  *   `priority` (*type:* `String.t`, *default:* `nil`) - Message priority. Can take "normal" and "high" values. For more information, see [Setting the priority of a message](https://goo.gl/GjONJv).
  *   `restrictedPackageName` (*type:* `String.t`, *default:* `nil`) - Package name of the application where the registration token must match in order to receive the message.
  *   `ttl` (*type:* `String.t`, *default:* `nil`) - How long (in seconds) the message should be kept in FCM storage if the device is offline. The maximum time to live supported is 4 weeks, and the default value is 4 weeks if not set. Set it to 0 if want to send the message immediately. In JSON format, the Duration type is encoded as a string rather than an object, where the string ends in the suffix "s" (indicating seconds) and is preceded by the number of seconds, with nanoseconds expressed as fractional seconds. For example, 3 seconds with 0 nanoseconds should be encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should be expressed in JSON format as "3.000000001s". The ttl will be rounded down to the nearest second.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :bandwidthConstrainedOk => boolean() | nil,
          :collapseKey => String.t() | nil,
          :data => map() | nil,
          :directBootOk => boolean() | nil,
          :fcmOptions => GoogleApi.FCM.V1.Model.AndroidFcmOptions.t() | nil,
          :notification => GoogleApi.FCM.V1.Model.AndroidNotification.t() | nil,
          :priority => String.t() | nil,
          :restrictedPackageName => String.t() | nil,
          :ttl => String.t() | nil
        }

  field(:bandwidthConstrainedOk)
  field(:collapseKey)
  field(:data, type: :map)
  field(:directBootOk)
  field(:fcmOptions, as: GoogleApi.FCM.V1.Model.AndroidFcmOptions)
  field(:notification, as: GoogleApi.FCM.V1.Model.AndroidNotification)
  field(:priority)
  field(:restrictedPackageName)
  field(:ttl)
end

defimpl Poison.Decoder, for: GoogleApi.FCM.V1.Model.AndroidConfig do
  def decode(value, options) do
    GoogleApi.FCM.V1.Model.AndroidConfig.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.FCM.V1.Model.AndroidConfig do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
